using System;
using System.Windows.Controls;
using System.Windows.Data;

namespace WizardSample
{
    /// <summary>
    /// 
    /// </summary>
    public class AuthenticationModeConverter : IValueConverter
    {
        public object Convert(object value, Type targetType,
            object parameter, System.Globalization.CultureInfo culture)
        {
            if (value != null && value is Boolean)
            {
                return ((Boolean)value);
            }
            return null;
        }

        public object ConvertBack(object value, Type targetType,
            object parameter, System.Globalization.CultureInfo culture)
        {
            if (value != null && value is Boolean)
            {
                return ((Boolean)value);
            }
            return null;
        }
    }

    public class NotAuthenticationModeConverter : IValueConverter
    {
        public object Convert(object value, Type targetType,
            object parameter, System.Globalization.CultureInfo culture)
        {
            if (value != null && value is Boolean)
            {
                return !((Boolean)value);
            }
            return null;
        }

        public object ConvertBack(object value, Type targetType,
            object parameter, System.Globalization.CultureInfo culture)
        {
            if (value != null && value is Boolean)
            {
                return !((Boolean)value);
            }
            return null;
        }
    }

    /// <summary>
    /// 
    /// </summary>
    public partial class WizardPageAuthService : WizardPageBase
    {
        public WizardPageAuthService()
        {
            InitializeComponent();
        }

        public override void BindToData(Object contextData)
        {
            AuthenticationWizardData wizardData = contextData as AuthenticationWizardData;

            if (wizardData != null)
            {
                // Bind wizard data
                this.DataContext = wizardData;
                this.ctrl_IisSiteList.ItemsSource = wizardData.IISSiteList;
                this.ctrl_IisSiteList.DisplayMemberPath = "IISSite";
                this.ctrl_IisSiteList.SelectedValuePath = "IISSiteId";
                this.ctrl_IisSiteList.SelectedIndex = 0 /*wizardData.IISSiteItem*/;
            }
        }
    }
}
